Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

feature/discovery/src/androidMain/kotlin/org/meshtastic/feature/discovery/export/ExportSaver.android.kt 4d4070c8e1ed73a56ee2f054300a0f62e3fe2e62 (4d4070c8) Text, 2.67 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.discovery.export

Tff7b72import T7ee787android.content.Intent
Tff7b72import T7ee787androidx.activity.compose.rememberLauncherForActivityResult
Tff7b72import T7ee787androidx.activity.result.contract.ActivityResultContracts
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.mutableStateOf
Tff7b72import T7ee787androidx.compose.runtime.remember
Tff7b72import T7ee787androidx.compose.runtime.rememberCoroutineScope
Tff7b72import T7ee787androidx.compose.ui.platform.LocalContext
Tff7b72import T7ee787co.touchlab.kermit.Logger
Tff7b72import T7ee787kotlinx.coroutines.Dispatchers
Tff7b72import T7ee787kotlinx.coroutines.launch
Tff7b72import T7ee787kotlinx.coroutines.withContext

Tf0883e@Composable
Tff7b72actual Tff7b72fun Td2a8ffrememberExportSaverTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3ExportSaverLauncher Tb4b4b4{
Tff7b72val Te6edf3context Tff7b72= Te6edf3LocalContextTb4b4b4.Te6edf3current
Tff7b72val Te6edf3scope Tff7b72= Te6edf3rememberCoroutineScopeTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3pendingExport Tff7b72= Te6edf3remember Tb4b4b4{ Te6edf3mutableStateOfTff7b72<Te6edf3ExportResultTb4b4b4.Te6edf3SuccessTff7b72?Tff7b72>Tb4b4b4(Tff7b72nullTb4b4b4) Tb4b4b4}

Tff7b72val Te6edf3launcher Tff7b72=
Te6edf3rememberLauncherForActivityResultTb4b4b4(Te6edf3ActivityResultContractsTb4b4b4.Te6edf3StartActivityForResultTb4b4b4(Tb4b4b4)Tb4b4b4) Tb4b4b4{ Te6edf3result Tff7b72-Tff7b72>
Tff7b72val Te6edf3uri Tff7b72= Te6edf3resultTb4b4b4.Te6edf3dataTff7b72?.Te6edf3data Tff7b72?: Tff7b72returnTf0883e@rememberLauncherForActivityResult
Tff7b72val Te6edf3export Tff7b72= Te6edf3pendingExportTb4b4b4.Te6edf3value Tff7b72?: Tff7b72returnTf0883e@rememberLauncherForActivityResult
Te6edf3pendingExportTb4b4b4.Te6edf3value Tff7b72= Tff7b72null
Te6edf3scopeTb4b4b4.Te6edf3launch Tb4b4b4{
Te6edf3withContextTb4b4b4(Te6edf3DispatchersTb4b4b4.Te6edf3IOTb4b4b4) Tb4b4b4{
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffTooGenericExceptionCaughtTa5d6ff"Tb4b4b4)
Tff7b72try Tb4b4b4{
Te6edf3contextTb4b4b4.Te6edf3contentResolverTb4b4b4.Te6edf3openOutputStreamTb4b4b4(Te6edf3uriTb4b4b4)Tff7b72?.Te6edf3use Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3writeTb4b4b4(Te6edf3exportTb4b4b4.Te6edf3contentTb4b4b4) Tb4b4b4}
Tb4b4b4} Tff7b72catch Tb4b4b4(Te6edf3eTb4b4b4: Te6edf3ExceptionTb4b4b4) Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3eTb4b4b4(Te6edf3throwable Tff7b72= Te6edf3eTb4b4b4) Tb4b4b4{ Ta5d6ff"Ta5d6ffFailed to write export fileTa5d6ff" Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}

Tff7b72return Te6edf3ExportSaverLauncher Tb4b4b4{ Te6edf3result Tff7b72-Tff7b72>
Te6edf3pendingExportTb4b4b4.Te6edf3value Tff7b72= Te6edf3result
Tff7b72val Te6edf3intent Tff7b72=
Te6edf3IntentTb4b4b4(Te6edf3IntentTb4b4b4.Te6edf3ACTION_CREATE_DOCUMENTTb4b4b4)Tb4b4b4.Te6edf3apply Tb4b4b4{
Te6edf3addCategoryTb4b4b4(Te6edf3IntentTb4b4b4.Te6edf3CATEGORY_OPENABLETb4b4b4)
Te6edf3type Tff7b72= Te6edf3resultTb4b4b4.Te6edf3mimeType
Te6edf3putExtraTb4b4b4(Te6edf3IntentTb4b4b4.Te6edf3EXTRA_TITLETb4b4b4, Te6edf3resultTb4b4b4.Te6edf3fileNameTb4b4b4)
Tb4b4b4}
Te6edf3launcherTb4b4b4.Te6edf3launchTb4b4b4(Te6edf3intentTb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.06s